import request from '@/utils/request'

export function getDepartments() {
  return request({
    url: '/company/department',
    method: 'GET'
  })
}

// 新增部门
export function getNewDepartment(data) {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}

// 根据 id 获取部门信息 用于数据回填
export function getDepById(id) {
  return request({
    url: `/company/department/` + id,
    method: 'GET'
  })
}

// 根据 id 修改部门详情
export function updateDepartmentInfo(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'PUT',
    data
  })
}

// 删除部门
export function delDepartment(id) {
  return request({
    url: '/company/department/' + id,
    method: 'DELETE'
  })
}

